package com.danco.training.zaneuskaya.serialization;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

import com.danco.training.zaneuskaya.property.PropertyAccess;



public class FileLoaderUtil {
	
	private static ObjectInputStream ois;

	public static Object load(){
		try{
			String fileName = PropertyAccess.getProperty("serializationfile");
	
		FileInputStream is = new FileInputStream(fileName);
		ois = new ObjectInputStream(is);
		while(is.available()>0){
            Object object = ois.readObject();
		
		return object;
		}
		}catch(ClassNotFoundException e){
		e.printStackTrace();
		}catch(IOException e){
		e.printStackTrace();
		}
		finally{
			try {
				ois.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return null;
		
		
		}

}
